// When dragging a window, we use this slot for reserve space.
this._reservedSlot = null;
this.metaWorkspace = metaWorkspace;
- this._x = 0;
- this._y = 0;
- this._width = 0;
- this._height = 0;
+
+ // The full geometry is the geometry we should try and position
+ // windows for. The actual geometry we allocate may be less than
+ // this, like if the workspace switcher is slid out.
+ this._fullGeometry = null;
this.monitorIndex = monitorIndex;
this._monitor = Main.layoutManager.monitors[this.monitorIndex];
this._positionWindowsId = 0;
},
- setGeometry: function(geom) {
- this._x = geom.x;
- this._y = geom.y;
- this._width = geom.width;
- this._height = geom.height;
+ setFullGeometry: function(geom) {
+ this._fullGeometry = geom;
Meta.later_add(Meta.LaterType.BEFORE_REDRAW, Lang.bind(this, function() {
this._dropRect.set_position(geom.x, geom.y);
let [x, y, mask] = global.get_pointer();
let pointerHasMoved = (this._cursorX != x && this._cursorY != y);
- let inWorkspace = (this._x < x && x < this._x + this._width &&
- this._y < y && y < this._y + this._height);
+ let inWorkspace = (this._fullGeometry.x < x && x < this._fullGeometry.x + this._fullGeometry.width &&
+ this._fullGeometry.y < y && y < this._fullGeometry.y + this._fullGeometry.height);
if (pointerHasMoved && inWorkspace) {
// store current cursor position
padding.right += rightBorder;
let area = {
- x: this._x + padding.left,
- y: this._y + padding.top,
- width: this._width - padding.left - padding.right,
- height: this._height - padding.top - padding.bottom,
+ x: this._fullGeometry.x + padding.left,
+ y: this._fullGeometry.y + padding.top,
+ width: this._fullGeometry.width - padding.left - padding.right,
+ height: this._fullGeometry.height - padding.top - padding.bottom,
};
let layout = this._computeLayout(windows, area, rowSpacing, columnSpacing);
const OVERRIDE_SCHEMA = 'org.gnome.shell.overrides';
+function rectEqual(one, two) {
+ if (one == two)
+ return true;
+
+ if (!one || !two)
+ return false;
+
+ return (one.x == two.x &&
+ one.y == two.y &&
+ one.width == two.width &&
+ one.height == two.height);
+}
const WorkspacesView = new Lang.Class({
Name: 'WorkspacesView',
this._updateWorkspaceActors(false);
}));
- this._width = 0;
- this._height = 0;
- this._x = 0;
- this._y = 0;
+ this._fullGeometry = null;
+
this._spacing = 0;
this._animating = false; // tweening
this._scrolling = false; // swipe-scrolling
this._overviewShownId =
Main.overview.connect('shown',
Lang.bind(this, function() {
- this.actor.set_clip(this._x, this._y,
- this._width, this._height);
+ this.actor.set_clip(this._fullGeometry.x, this._fullGeometry.y,
+ this._fullGeometry.width, this._fullGeometry.height);
}));
this.scrollAdjustment = new St.Adjustment({ value: activeWorkspaceIndex,
continue;
let ws = new Workspace.Workspace(null, i);
- ws.setGeometry(monitors[i]);
+ ws.setFullGeometry(monitors[i]);
global.overlay_group.add_actor(ws.actor);
this._extraWorkspaces.push(ws);
}
this._extraWorkspaces = [];
},
- setGeometry: function(geom) {
- if (this._x == geom.x && this._y == geom.y &&
- this._width == geom.width && this._height == geom.height)
+ setFullGeometry: function(geom) {
+ if (rectEqual(this._fullGeometry, geom))
return;
- this._width = geom.width;
- this._height = geom.height;
- this._x = geom.x;
- this._y = geom.y;
+ this._fullGeometry = geom;
for (let i = 0; i < this._workspaces.length; i++)
- this._workspaces[i].setGeometry(geom);
+ this._workspaces[i].setFullGeometry(geom);
},
_lookupWorkspaceForMetaWindow: function (metaWindow) {
Tweener.removeTweens(workspace.actor);
- let y = (w - active) * (this._height + this._spacing);
+ let y = (w - active) * (this._fullGeometry.height + this._spacing);
if (showAnimation) {
let params = { y: y,
if (newNumWorkspaces > oldNumWorkspaces) {
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
- this._workspaces[w].setGeometry({ x: this._x,
- y: this._y,
- width: this._width,
- height: this._height });
+ this._workspaces[w].setFullGeometry(this._fullGeometry);
this.actor.add_actor(this._workspaces[w].actor);
}
this._notifyOpacityId = 0;
this._scrollEventId = 0;
+
+ this._fullGeometry = null;
},
_onPan: function(action) {
this._workspacesViews.push(view);
}
- this._updateWorkspacesGeometry();
+ this._updateWorkspacesFullGeometry();
for (let i = 0; i < this._workspacesViews.length; i++)
global.overlay_group.add_actor(this._workspacesViews[i].actor);
// This geometry should always be the fullest geometry
// the workspaces switcher can ever be allocated, as if
// the sliding controls were never slid in at all.
- setWorkspacesGeometry: function(geom) {
- this._geometry = geom;
- this._updateWorkspacesGeometry();
+ setWorkspacesFullGeometry: function(geom) {
+ this._fullGeometry = geom;
+ this._updateWorkspacesFullGeometry();
},
- _updateWorkspacesGeometry: function() {
+ _updateWorkspacesFullGeometry: function() {
if (!this._workspacesViews.length)
return;
let m = 0;
for (let i = 0; i < monitors.length; i++) {
if (i == this._primaryIndex) {
- this._workspacesViews[m].setGeometry(this._geometry);
+ this._workspacesViews[m].setFullGeometry(this._fullGeometry);
m++;
} else if (!this._workspacesOnlyOnPrimary) {
- this._workspacesViews[m].setGeometry(monitors[i]);
+ this._workspacesViews[m].setFullGeometry(monitors[i]);
m++;
}
}